using System;
using System.Collections.Generic;

namespace Examples.StringTemplate
{
    public class Templates
    {
        public static TemplateData WithoutHoles = new TemplateData("The template without any holes", "The template without any holes");
        public static TemplateData WithAHole = new TemplateData("The template with a $hole$ in it", new PropertyBag(new Pair("hole", "giant big whopping space")), "The template with a giant big whopping space in it");
        public static TemplateData WithSubtemplate = new TemplateData("The template with a $hole()$ in it", "The template with a $hole()$ in it");
        public static TemplateData ObjectRender = new TemplateData("The template with a hole in it for the date of $date$", new PropertyBag(new Pair("date", new DateTime(2009, 8, 7))), "The template with a hole in it for the date of Awesome 2009", new AwesomeDateRenderer());
    }

    public class TemplateData
    {
        
        public TemplateData(string template, PropertyBag bag, string expectedRenderedText)
        {
            Template = template;
            PropertyBag = bag;
            Expected = expectedRenderedText;
            Renderers = new List<IRenderer>();
        }

        public TemplateData(string template, string expectedRenderedText) : this(template, new PropertyBag(), expectedRenderedText)
        {
            
        }

        public TemplateData(string template, PropertyBag bag, string expectedRenderedText, params IRenderer[] renderers)
        {
            Template = template;
            PropertyBag = bag;
            Expected = expectedRenderedText;
            Renderers = new List<IRenderer>(renderers);
        }

        public string Template { get; private set; }


        public PropertyBag PropertyBag { get; private set; }

        public string Expected { get; private set; }

        public IEnumerable<IRenderer> Renderers { get; private set; }

    }
}